package com.example.hehecat.yuejian1.mvp.presenter;

import android.util.Log;

import com.example.hehecat.yuejian1.mvp.contract.MasterCollectContract;
import com.example.hehecat.yuejian1.mvp.model.MasterCollectModel;
import com.example.hehecat.yuejian1.mvp.model.bean.MasterBean;

import java.util.List;

import rx.Subscriber;

import static com.chad.library.adapter.base.listener.SimpleClickListener.TAG;

public class MasterCollectPresenter implements MasterCollectContract.Presenter {

    private MasterCollectContract.View view;
    private MasterCollectContract.Model model;

    public MasterCollectPresenter(MasterCollectContract.View view){
        this.view = view;
        model = new MasterCollectModel();
    }
    @Override
    public void updateAdapterData(int user_id) {
        model.getMasterCollect(user_id, new Subscriber<List<MasterBean>>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(List<MasterBean> masterBeans) {
                Log.d(TAG,"onNext" +masterBeans.get(0).getMastername());
                view.updateAdapterData(masterBeans);
            }
        });
    }
}
